!function (a) {
    a(["jquery"], function (a) {
        return function () {
            function b(a, b, c) {
                return o({type: u.error, iconClass: p().iconClasses.error, message: a, optionsOverride: c, title: b})
            }

            function c(b, c) {
                return b || (b = p()), r = a("#" + b.containerId), r.length ? r : (c && (r = l(b)), r)
            }

            function d(a, b, c) {
                return o({type: u.info, iconClass: p().iconClasses.info, message: a, optionsOverride: c, title: b})
            }

            function e(a) {
                s = a
            }

            function f(a, b, c) {
                return o({
                    type: u.success,
                    iconClass: p().iconClasses.success,
                    message: a,
                    optionsOverride: c,
                    title: b
                })
            }

            function g(a, b, c) {
                return o({
                    type: u.warning,
                    iconClass: p().iconClasses.warning,
                    message: a,
                    optionsOverride: c,
                    title: b
                })
            }

            function h(a) {
                var b = p();
                r || c(b), k(a, b) || j(b)
            }

            function i(b) {
                var d = p();
                return r || c(d), b && 0 === a(":focus", b).length ? void q(b) : void(r.children().length && r.remove())
            }

            function j(b) {
                for (var c = r.children(), d = c.length - 1; d >= 0; d--)k(a(c[d]), b)
            }

            function k(b, c) {
                return b && 0 === a(":focus", b).length ? (b[c.hideMethod]({
                    duration: c.hideDuration,
                    easing: c.hideEasing,
                    complete: function () {
                        q(b)
                    }
                }), !0) : !1
            }

            function l(b) {
                return r = a("<div/>").attr("id", b.containerId).addClass(b.positionClass).attr("aria-live", "polite").attr("role", "alert"), r.appendTo(a(b.target)), r
            }

            function m() {
                return {
                    tapToDismiss: !0,
                    toastClass: "toast",
                    containerId: "toast-container",
                    debug: !1,
                    showMethod: "fadeIn",
                    showDuration: 300,
                    showEasing: "swing",
                    onShown: void 0,
                    hideMethod: "fadeOut",
                    hideDuration: 1e3,
                    hideEasing: "swing",
                    onHidden: void 0,
                    extendedTimeOut: 1e3,
                    iconClasses: {
                        error: "toast-error",
                        info: "toast-info",
                        success: "toast-success",
                        warning: "toast-warning"
                    },
                    iconClass: "toast-info",
                    positionClass: "toast-top-right",
                    timeOut: 5e3,
                    titleClass: "toast-title",
                    messageClass: "toast-message",
                    target: "body",
                    closeHtml: "<button>&times;</button>",
                    newestOnTop: !0
                }
            }

            function n(a) {
                s && s(a)
            }

            function o(b) {
                function d(b) {
                    return !a(":focus", j).length || b ? j[g.hideMethod]({
                        duration: g.hideDuration,
                        easing: g.hideEasing,
                        complete: function () {
                            q(j), g.onHidden && "hidden" !== o.state && g.onHidden(), o.state = "hidden", o.endTime = new Date, n(o)
                        }
                    }) : void 0
                }

                function e() {
                    (g.timeOut > 0 || g.extendedTimeOut > 0) && (i = setTimeout(d, g.extendedTimeOut))
                }

                function f() {
                    clearTimeout(i), j.stop(!0, !0)[g.showMethod]({duration: g.showDuration, easing: g.showEasing})
                }

                var g = p(), h = b.iconClass || g.iconClass;
                "undefined" != typeof b.optionsOverride && (g = a.extend(g, b.optionsOverride), h = b.optionsOverride.iconClass || h), t++, r = c(g, !0);
                var i = null, j = a("<div/>"), k = a("<div/>"), l = a("<div/>"), m = a(g.closeHtml), o = {
                    toastId: t,
                    state: "visible",
                    startTime: new Date,
                    options: g,
                    map: b
                };
                return b.iconClass && j.addClass(g.toastClass).addClass(h), b.title && (k.append(b.title).addClass(g.titleClass), j.append(k)), b.message && (l.append(b.message).addClass(g.messageClass), j.append(l)), g.closeButton && (m.addClass("toast-close-button").attr("role", "button"), j.prepend(m)), j.hide(), g.newestOnTop ? r.prepend(j) : r.append(j), j[g.showMethod]({
                    duration: g.showDuration,
                    easing: g.showEasing,
                    complete: g.onShown
                }), g.timeOut > 0 && (i = setTimeout(d, g.timeOut)), j.hover(f, e), !g.onclick && g.tapToDismiss && j.click(d), g.closeButton && m && m.click(function (a) {
                    a.stopPropagation ? a.stopPropagation() : void 0 !== a.cancelBubble && a.cancelBubble !== !0 && (a.cancelBubble = !0), d(!0)
                }), g.onclick && j.click(function () {
                    g.onclick(), d()
                }), n(o), g.debug && console && console.log(o), j
            }

            function p() {
                return a.extend({}, m(), v.options)
            }

            function q(a) {
                r || (r = c()), a.is(":visible") || (a.remove(), a = null, 0 === r.children().length && r.remove())
            }

            var r, s, t = 0, u = {error: "error", info: "info", success: "success", warning: "warning"}, v = {
                clear: h,
                remove: i,
                error: b,
                getContainer: c,
                info: d,
                options: {},
                subscribe: e,
                success: f,
                version: "2.0.3",
                warning: g
            };
            return v
        }()
    })
}("function" == typeof define && define.amd ? define : function (a, b) {
    "undefined" != typeof module && module.exports ? module.exports = b(require("jquery")) : window.toastr = b(window.jQuery)
});